package interfaces1;

class Dog3 implements Comparable<Dog3>{
	private int x;
	private double y;
	public Dog3( int x_in, double y_in){
		x = x_in; y = y_in;
	}
	public String toString(){
		return "( " + x + ", " + y + " )";
	}
	public int compareTo(Dog3 o) {
		if (x > o.x)
		  return 1;
		if (x < o.x)
			return -1;
		return 0;
	}
}
public class Comparing3 {

	public static void main(String[] args) {
		Dog3 a = new Dog3( 4, 5.0 );
		Dog3 b = new Dog3( 7, 3.2 );
		
		System.out.println(" a is " + a);
		System.out.println(" b is " + b);
		
		System.out.println(" comparing a and b: " + a.compareTo(b));
		System.out.println(" comparing b and a: " + b.compareTo(a));
		System.out.println(" comparing a and a: " + a.compareTo(a));
		System.out.println(" comparing b and b: " + b.compareTo(b));
	}
}
